<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script type="text/javascript" src="../cordova.js"></script>
    <script type="text/javascript" src="../myPlugins/StatusBarNotification.js"></script>
</head>
<body>
<script>
    function notify() {
        alert(1)
        NotificationMessenger.notify("这是一条通知", "通知的目的是测试");
        navigator.notification.beep(1);//铃声
//        setTimeout(clear,1000)
    }
    setTimeout("notify()", 10000);
    function clear() {
        alert(222)
        NotificationMessenger.clear();
    }
</script>

<button id="qingkong">清空通知消息</button>
<br/>

<label>振动时间：<input id="s" value="20">毫秒</label>
<button id="vibrate" style="width: 100px;height: 100px">振动</button>
<script>
    function vibrate() {
//        alert(1)
        var s = document.getElementById('s').value;
        navigator.vibrate(s*1);//可用
        navigator.notification.vibrate(s * 1);//可用
    }
    /*
     * 振动
     * */
    document.getElementById('vibrate').onclick = function(){
        vibrate();
    }
    /*
    * 清空消息通知
    * */
    document.getElementById('qingkong').onclick = function(){
        clear();
    }
    /*
     * 判断从后台进入到前台，也就是打开应用
     * */
    var inApp = function(){
        document.addEventListener("resume", yourCallbackFunction, false);
        function yourCallbackFunction(){
            alert("进入应用弹出框")
        }
    }
    inApp();
    var x = navigator;
    document.write("CodeName=" + x.appCodeName);
    document.write("<br />");
    document.write("MinorVersion=" + x.appMinorVersion);
    document.write("<br />");
    document.write("Name=" + x.appName);
    document.write("<br />");
    document.write("Version=" + x.appVersion);
    document.write("<br />");
    document.write("CookieEnabled=" + x.cookieEnabled);
    document.write("<br />");
    document.write("CPUClass=" + x.cpuClass);
    document.write("<br />");
    document.write("OnLine=" + x.onLine);
    document.write("<br />");
    document.write("Platform=" + x.platform);
    document.write("<br />");
    document.write("UA=" + x.userAgent);
    document.write("<br />");
    document.write("BrowserLanguage=" + x.browserLanguage);
    document.write("<br />");
    document.write("SystemLanguage=" + x.systemLanguage);
    document.write("<br />");
    document.write("UserLanguage=" + x.userLanguage);
</script>
</body>
</html>